//
//  DXMLJamObject.h
//  DerbyStatter
//
//  Created by glenn andreas on 1/29/14.
//  Copyright (c) 2014 glenn andreas. All rights reserved.
//

#import "DXMLEventObject.h"
@class DXMLTimestamp;
@class DXMLPeriodObject;
@class DXMLTeamObject;
@class DXMLPassObject;
@class DXMLPersonObject;

@interface DXMLJamObject : DXMLEventObject
@property (strong) DXMLTimestamp *jamEnd;
@property (assign) NSInteger number;
@property (readonly) DXMLPeriodObject *period;
// these are team specific
- (NSInteger) numberOfPasses: (DXMLTeamObject *) team;
- (id) passAtIndex: (NSInteger) index team: (DXMLTeamObject *) team;
- (id) passAtIndex: (NSInteger) index team: (DXMLTeamObject *) team source: (DXMLEventSource) source;
- (void) enumeratePasses: (void (^)(DXMLPassObject *child, BOOL *stop)) block team: (DXMLTeamObject *) team;

- (NSInteger) numberOfChildrenOfClass: (Class) cls team: (DXMLTeamObject *) team;
- (id) childOfClass: (Class) cls atIndex: (NSInteger) index  team: (DXMLTeamObject *) team;
- (id) childOfClass:(Class)cls atIndex:(NSInteger)index team: (DXMLTeamObject *) team source:(DXMLEventSource)source;
- (void) enumerateChildren: (void (^)(DXMLEventObject *child, BOOL *stop)) block ofClass: (Class) cls  team: (DXMLTeamObject *) team;;
// derived info
- (NSInteger) score: (DXMLTeamObject *) team;
- (NSInteger) startingScore: (DXMLTeamObject *) team;
- (BOOL) lead: (DXMLTeamObject *) team;
- (BOOL) lostLead: (DXMLTeamObject *) team;
- (BOOL) call: (DXMLTeamObject *) team;
- (BOOL) injury;
- (BOOL) noPass: (DXMLTeamObject *) team;
- (BOOL) hasStarPass: (DXMLTeamObject *) team;
- (NSDictionary *) lineupForTeam: (DXMLTeamObject *) team; // uses DSXLineupPosition keys, with blocker returning an array
- (NSTimeInterval) duration;
- (DXMLPersonObject *) jammer: (DXMLTeamObject *) team;
@end
